package nachos.threads;

import nachos.machine.*;

/**
 * A Simple Tester for the KThread class. 
 */
public class KThreadSimpleTest {

////////////// BEGIN HENRI ////////////////
    private static class HelloWorldThread implements Runnable {

	/* Constructor */
        HelloWorldThread() {
        }

        public void run() {
          System.out.println("Hello world!");
          return; 
        }
    }
////////////// END HENRI ////////////////

    /**
     * Tests whether this module is working.
     */
    public static void runTest() {

	System.out.println("**** Simple KThread testing begins ****");
////////////// BEGIN HENRI ////////////////
	KThread threads[] = new KThread[2];
        for (int i=0; i < 2; i++) {
          threads[i] = new KThread(new HelloWorldThread());
          threads[i].setName("HelloWorldThread-"+(i+1));
          threads[i].fork();
        }
////////////// END HENRI ////////////////

        
	KThread.yield();
	System.out.println("**** Simple KThread testing ends ****");
    }

}
